package com.dbh.company.map.gaode;

import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpUtil;
import cn.hutool.json.JSONUtil;

import java.util.HashMap;
import java.util.Map;

/**
 * 等时圈相关接口
 * @author dongbanghui
 * @create 2023/8/14
 */
public class Isochrone {

    public static void main(String[] args) {
        String walking = walking();
        System.out.println(walking);
    }


    public static void getNearbyRadiusForDitu() {

        String url = "https://restapi.amap.com/rest/me/isochrone";
        Map<String, Object> param = new HashMap<>();
        double x = 116.313348;
        double y = 40.053734;
        param.put("x", x);
        param.put("y", y);
        param.put("type", 2);
        param.put("mode", 0);
        param.put("radius", 15);
        param.put("key", "e60ff556ebaa394684f44c686591d2f1");
        String result = HttpRequest.post(url)
                .body(JSONUtil.toJsonStr(param))
                .execute()
                .body();
        System.out.println(result);
    }

    public static String walking() {
        String url = "https://restapi.amap.com/v3/direction/walking?";
        String parameters = "origin=116.313348,40.053734&destination=116.3795,40.104648&key=e60ff556ebaa394684f44c686591d2f1";
        String body = HttpRequest.get(url + parameters)
                .execute().body();
        return body;
    }


}
